package cn.itcast.dubbo.service.impl;

import cn.itcast.dubbo.common.ReadOnly;
import cn.itcast.dubbo.mapper.AdminMapper;
import cn.itcast.dubbo.pojo.Admin;
import cn.itcast.dubbo.service.AdminService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.Resource;

/**
 * @author Hujf
 * @title: AdminServiceImpl
 * @description: TODO
 * @date 2020/7/22 0022上午 10:42
 */

@Service(version = "${dubbo.service.version}")
public class AdminServiceImpl implements AdminService {

    @Resource
    private AdminMapper adminMapper;
    @Override
    @ReadOnly
    public Admin findAdminByNameAndPwd(String name, String pwd) {
        Admin admin = adminMapper.findByNameAndPwd(name);
        if (admin.getPassword().equals(pwd)) {
            return admin;
        }
        return null;
    }
}
